package com.goscom.app.deeset;

import com.goscom.app.database.DBAdapter;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

public class MedicalHistory extends Activity {

	private String strMerId = "";
	private DBAdapter mDB;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.medicalhistory);

		mDB = new DBAdapter(MedicalHistory.this);
		mDB.open();

		getMerId();
	}

	public void getMerId() {
		try {
			strMerId = getIntent().getStringExtra("merid");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void clickMedicalSecA(View v) {
		Intent intent = new Intent(MedicalHistory.this, Section.class);
		intent.putExtra("merid", strMerId);
		intent.putExtra("activity", "sectiona");
		startActivity(intent);
	}

	public void clickMedicalSecB(View v) {
		Intent intent = new Intent(MedicalHistory.this, Section.class);
		intent.putExtra("merid", strMerId);
		intent.putExtra("activity", "sectionb");
		startActivity(intent);
	}

	public void clickMedicalSecC(View v) {
		Intent intent = new Intent(MedicalHistory.this, Section.class);
		intent.putExtra("merid", strMerId);
		intent.putExtra("activity", "sectionc");
		startActivity(intent);
	}

	public void clickMedicalSecD(View v) {
		Intent intent = new Intent(MedicalHistory.this, Section.class);
		intent.putExtra("merid", strMerId);
		intent.putExtra("activity", "sectiond");
		startActivity(intent);
	}

	public void Logout(View v) {
		if (mDB != null) {
			mDB.close();
		}
		startActivity(new Intent(MedicalHistory.this, Login.class));
	}

	public void goPrevious(View v) {
		if (mDB != null) {
			mDB.close();
		}
		startActivity(new Intent(MedicalHistory.this, ContractedHours.class)
				.putExtra("merid", strMerId));
	}

	public void goNext(View v) {
		if (mDB != null) { 
			mDB.close(); 
		} 
		startActivity(new Intent(MedicalHistory.this, ContractualAgreement.class).putExtra("merid", strMerId));
	}

	@Override
	protected void onRestart() {
		mDB.open();
		super.onRestart();
	}

	@Override
	protected void onDestroy() {
		if (mDB != null) {
			mDB.close();
		}
		super.onDestroy();
	}
}
